package com.jobjoin.jobjoin.user.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author WinsomeCheong
 * @date 2021-04-19 16:02
 **/
@Configuration
@EnableSwagger2
public class Swagger2Config {
    @Configuration
    @EnableSwagger2
    public class SwaggerConfig {
        @Bean
        public Docket createRestApi() {
            return new Docket(DocumentationType.SWAGGER_2)
                    .groupName("webApi")
                    .pathMapping("/")
                    .select()
                    .apis(RequestHandlerSelectors.basePackage("com.jobjoin.jobjoin"))
                    .paths(PathSelectors.any())
                    .build().apiInfo(new ApiInfoBuilder()
                            .title("职趣API文档")
                            .description("本文档描述职趣接口详细信息......")
                            .version("1.0")
                            .contact(new Contact("WinsomeC","com.jobjoin.jobjoin","zhangwanchun_n@foxmail.com"))
                            .license("The Apache License")
                            .licenseUrl("http://www.baidu.com")
                            .build());
        }

        private ApiInfo webApiInfo(){
            return new ApiInfoBuilder()
                    .title("职趣API文档")
                    .build();
        }
    }

}
